package convert

import "strconv"

type StrTo string

func (s StrTo) String() string {
	return string(s)
}

// 转int
func (s StrTo) Int() (int, error) {
	v, err := strconv.Atoi(s.String())
	return v, err
}

func (s StrTo) MustInt() int {
	v, _ := s.Int()
	return v
}

func (s StrTo) Int64() (int64, error) {
	v, err := strconv.Atoi(s.String())
	return int64(v), err
}

func (s StrTo) MustInt64() int64 {
	v, _ := s.Int64()
	return v
}
